package com.zygh.lz.service.role;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zygh.lz.dao.app.AppMenuMapper;
import com.zygh.lz.entity.app.AppMenu;
import com.zygh.lz.service.impl.StaffServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AppMenuService extends ServiceImpl<AppMenuMapper, AppMenu> {

    @Resource
    private StaffServiceImpl staffService;

    public List<AppMenu> tree() {
        // 获取所有菜单信息
        List<AppMenu> sysMenus = this.list(new QueryWrapper<AppMenu>().orderByAsc("sort"));

        // 转成树状结构
        return staffService.buildTreeMenu(sysMenus);
    }




}
